<!-- components/JobItem.vue -->
<template>
  <div class="job-item">
    <nuxt-link :to="`/${articleType}/${job.id}`" class="job-link">
      <h2>{{ job.title }}</h2>
      <div class="meta">
        <span><i class="fas fa-building"></i> 公司: {{ job.company }}</span>
        <span><i class="fas fa-map-marker-alt"></i> 地点: {{ job.location }}</span>
        <span><i class="fas fa-money-bill-wave"></i> 薪资: {{ job.salary }}</span>
      </div>
      <div class="job-experience">
        <span><i class="fas fa-briefcase"></i> 经验要求: {{ job.experience }}</span>
      </div>
      <p class="job-description">{{ job.description }}</p>
    </nuxt-link>
  </div>
</template>

<script>
export default {
  name: "JobItem",
  props: {
    job: {
      type: Object,
      required: true,
    },
    articleType: {
      type: String,
      required: true,
      default: 'jobs'
    },
  },
};
</script>

<style>
.job-item {
  margin-bottom: 30px;
  padding: 15px 20px;
  margin: 20px;
  border-bottom: 1px solid #eee;
  border-radius: 5px;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.job-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.job-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.job-item h2 {
  margin-top: 0;
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
}

.meta {
  color: #7f8c8d;
  margin: 10px 0;
  font-size: 0.9em;
  display: flex;
  flex-wrap: wrap;
}

.meta span {
  margin-right: 15px;
  margin-bottom: 5px;
}

.job-experience {
  color: #e67e22;
  font-weight: 500;
  margin-bottom: 10px;
  font-size: 0.9em;
}

.job-description {
  color: #555;
  line-height: 1.5;
  margin-top: 10px;
  font-size: 0.95em;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .meta {
    flex-direction: column;
  }
  
  .meta span {
    margin-bottom: 5px;
  }
}
</style>
